Component({
    options: {
        addGlobalClass: true
    },
    properties: {
        info: {
            type: Object,
            value: {}
        },
        linkList: {
            type: Array,
            value: []
        },
        type: {
            type: String,
            value: ''
        }
    },
    data: {
        label: {
            product: {
                typeName: '产品',
                listTitle: '所需物料列表',
                linkButtonText: '关联物料'
            },
            material: {
                typeName: '物料',
                listTitle: '可生产产品列表',
                linkButtonText: '关联产品'
            }
        }
    },
    methods: {
        toLinkView(e) {
            console.log(e)
            const type = this.data.type
            console.log(type)
            if (type === 'product') {
                const id = this.data.info.id
                wx.navigateTo({
                    url: `/pages/product/link/index?id=${id}`,
                })
            } else if (type === 'material') {
                const id = this.data.info.id
                wx.navigateTo({
                    url: `/pages/material/link/index?id=${id}`,
                })
            }
        }
    }
});
